package com.cdtye.itps.cms.service.defect;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.cdtye.common.mybatiscore.base.BaseService;
import com.cdtye.itps.cms.dao.defect.entity.JcwProblemDefectLevel;
import com.cdtye.itps.cms.dao.defect.vo.JcwProblemDefectLevelVo;
import com.cdtye.itps.cms.mapper.defect.JcwProblemDefectLevelMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
@Slf4j
public class JcwProblemDefectLevelService extends BaseService<JcwProblemDefectLevelMapper, JcwProblemDefectLevel> {

    @Autowired
    private JcwProblemDefectLevelMapper baseMapper;
    /**
     * findOneByLevelName
     * @param levelName
     * @return
     */
    public JcwProblemDefectLevel findOneByLevelName(String levelName){
        QueryWrapper<JcwProblemDefectLevel> wrapper = new QueryWrapper<>();
        wrapper.eq("level_name",levelName);
        return baseMapper.selectOne(wrapper);
    }

    /**
     * 列表获取
     * @param vo
     * @return
     */
    public List<Map<String,Object>> getList(JcwProblemDefectLevelVo vo){
        return baseMapper.getList(vo);
    }

    /**
     * 分页查询
     * @param vo
     * @return
     */
    public IPage<Map<String,Object>> pageList(JcwProblemDefectLevelVo vo){
        return baseMapper.pageList(vo.page(),vo);
    }

    public JcwProblemDefectLevel getJcwProblemDefectLevelById(String id){
        return baseMapper.selectById(id);
    }
}
